<script setup lang="ts">
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
import {onMounted, ref} from "vue";
import cache from "@/utils/cache";
import {TOKEN_KEY} from "@/enums/cacheEnums";
onLaunch(() => {
  console.log("App Launch");
});
onShow(() => {
  console.log("App Show");
});
onHide(() => {
  console.log("App Hide");
});
onMounted(()=>{
  window.addEventListener('message', handleMessage);
})
const token=ref('')
const handleMessage=(event:any)=>{
  if (event.origin !== 'http://192.168.1.21:9910') {
    return;
  }
  token.value=event.data
  console.log(token.value)
  cache.set(TOKEN_KEY,token.value)
  const urlParams = new URLSearchParams(location.search);
  const redirect=urlParams.get('redirect')

}
</script>
<style></style>
